package com.zhuoyue.biz.core.api.dto.req;

import com.zhuoyue.common.group.ValidationGroups;
import lombok.Data;

import javax.validation.constraints.*;

/**
 * @author wjming
 * @ClassName: Geofencing
 * @Description: 地理栅栏数据库对象信息
 * @Date 2021-07-06 13:10
 */
@Data
public class GeofencingReqDTO {
    /**
     * 地理围栏Id
     */
    @NotBlank(message = "id不能为空", groups = {ValidationGroups.Update.class})
    @Size(max = 40, groups = {ValidationGroups.Update.class})
    private String id;

    /**
     * 网关ID
     */
    @NotBlank(message = "网关ID不能为空", groups = {ValidationGroups.Insert.class})
    @Null(message = "gatewayId为空", groups = {ValidationGroups.Update.class})
    @Size(max = 40, groups = {ValidationGroups.Insert.class})
    private String gatewayId;

    /**
     * 执行名称
     */
    @NotBlank(message = "id不能为空", groups = {ValidationGroups.Insert.class})
    @Size(max = 15, message = "名称最长15位", groups = {ValidationGroups.Update.class, ValidationGroups.Insert.class})
    private String name;

    /**
     * 场景ID
     */
    @NotBlank(message = "场景ID不能为空", groups = {ValidationGroups.Insert.class})
    @Size(max = 40, message = "场景ID最长为40", groups = {ValidationGroups.Update.class, ValidationGroups.Insert.class})
    private String sceneId;

    /**
     * 离家距离
     */
    @NotNull(message = "距离不能为空", groups = {ValidationGroups.Insert.class})
    @Digits(integer = 1, fraction = 1, message = "距离数据格式不正确", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
    @DecimalMax(value = "5", message = "距离最大是5", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
    private Double distance;

    /**
     * 使能判断
     */
    @NotNull(message = "使能类型不能为空", groups = {ValidationGroups.Insert.class})
    private Boolean enable;

    /**
     * 周一到周日ListString
     * "[0]"
     * "1,2,3,4,5,6,7"
     */
    @NotBlank(message = "日期设置不能为空", groups = {ValidationGroups.Insert.class})
    @Size(max = 15, message = "日期设置最长为15", groups = {ValidationGroups.Update.class, ValidationGroups.Insert.class})
    @Pattern(regexp = "\\d+(,\\d+)+|0", message = "内容不匹配", groups = {ValidationGroups.Update.class, ValidationGroups.Insert.class})
    private String time;

    /**
     * 0:圈内，1圈外
     */
    @NotBlank(message = "围栏类型不能为空", groups = {ValidationGroups.Insert.class})
    @Size(max = 1, message = "类型最长为1", groups = {ValidationGroups.Insert.class})
    @Null(message = "type为空", groups = {ValidationGroups.Update.class})
    private String type;


}